﻿// <copyright file="MissingApiKeyException.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-05-07</date>
// <summary>MissingApiKeyException class definition</summary>

namespace NYTimes.Core
{
    using System;
    using System.Globalization;
    using System.Runtime.Serialization;

    /// <summary>
    /// Missing API Key exception
    /// </summary>
#if SILVERLIGHT
#else
    [Serializable]
#endif
    public class MissingApiKeyException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the MissingApiKeyException class.
        /// </summary>
        public MissingApiKeyException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the MissingApiKeyException class.
        /// </summary>
        /// <param name="message">the error message</param>
        public MissingApiKeyException(string message) :
            base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the MissingApiKeyException class.
        /// </summary>
        /// <param name="message">the error message</param>
        /// <param name="innerException">the inner exception</param>
        public MissingApiKeyException(string message, Exception innerException) :
            base(message, innerException)
        {
        }

        /// <summary>
        /// Initializes a new instance of the MissingApiKeyException class.
        /// </summary>
        /// <param name="clrClassName">the CLR Class name</param>
        /// <param name="apiKeyName">the API Key name</param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ApiKey", Justification = "ApiKey is the property name.")]
        public MissingApiKeyException(string clrClassName, string apiKeyName) :
            base(string.Format(CultureInfo.CurrentCulture, "API key {0} in not in Application.Resource or {1}.ApiKey", apiKeyName, clrClassName))
        {
        }
    }
}
